bitkeeper revision 1.1159.96.4 (415c287dKBbK9HPtAge67WfTsJsnwQ)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 30 Sep 2004 15:38:37 +0000 (15:38 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 30 Sep 2004 15:38:37 +0000 (15:38 +0000)
Delay configuring the new domain during migration to localhost.

tools/python/xen/xend/XendMigrate.py
tools/xfrd/xen_domain.c
tools/xfrd/xfrd.c

index a2bf83389fbaf2437365926c3efd1a28e07a9342..f1bcf67c67385949733159517f32d0e1ca1cae45 100644 (file)
@@ -302,18 +302,18 @@ class XendMigrateInfo(XfrdInfo):
                       self.dst_port,
                       self.live ])
         
-    def xfr_vm_suspend(self, xfrd, val):
-        def cbok(val):
-            # Special case for localhost: destroy devices early.
-            if self.dst_host in ["localhost", "127.0.0.1"]:
-                self.dominfo.restart_cancel()
-                self.dominfo.cleanup()
-                self.dominfo.destroy_console()
-            return val
+##     def xfr_vm_suspend(self, xfrd, val):
+##         def cbok(val):
+##             # Special case for localhost: destroy devices early.
+##             if self.dst_host in ["localhost", "127.0.0.1"]:
+##                 self.dominfo.restart_cancel()
+##                 self.dominfo.cleanup()
+##                 self.dominfo.destroy_console()
+##             return val
             
-        d = XfrdInfo.xfr_vm_suspend(self, xfrd, val)
-        d.addCallback(cbok)
-        return d
+##         d = XfrdInfo.xfr_vm_suspend(self, xfrd, val)
+##         d.addCallback(cbok)
+##         return d
     
     def xfr_migrate_ok(self, xfrd, val):
         dom = int(sxp.child0(val))
index 5e535301b4cbf173a5dc29fc14b17811e3a88fde..feb0d9d02b72ba7be6f4d4c0db57ae3067c6c425 100644 (file)
@@ -138,7 +138,9 @@ int xen_domain_rcv(IOStream *io,
     ioctxt->info = iostdout;
     ioctxt->err = iostderr;
     ioctxt->configure = domain_configure;
-    ioctxt->flags |= XCFLAGS_CONFIGURE;
+    if(!configured){
+        ioctxt->flags |= XCFLAGS_CONFIGURE;
+    }
 
     err = xc_linux_restore(xcinit(), ioctxt);
     *dom = ioctxt->domain;
index e2b6e98fa1406375ab057b1f414d55103739bf3a..2a73d7a64ba5fcc5a0bbdc417a54c21ad68ded7a 100644 (file)
@@ -841,7 +841,14 @@ int xfr_recv(Args *args, XfrState *state, Conn *peer){
     Sxpr sxpr;
     int configured=0;
 
-    dprintf(">\n");
+    dprintf("> peer=%s\n", inet_ntoa(peer->addr.sin_addr));
+    // If receiving from localhost set configured so that that xen_domain_rcv()
+    // does not attempt to configure the new domain. This is because the old
+    // domain still exists and will make it fail.
+    if(peer->addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)){
+        dprintf("> Peer is localhost\n");
+        configured = 1;
+    }
     err = xen_domain_rcv(peer->in,
                          &state->vmid_new,
                          &state->vmconfig, &state->vmconfig_n,
@@ -853,6 +860,7 @@ int xfr_recv(Args *args, XfrState *state, Conn *peer){
     err = Conn_sxpr(peer, &sxpr);
     if(err) goto exit;
     if(!configured){
+        dprintf("> Configuring...\n");
         err = xen_domain_configure(state->vmid_new, state->vmconfig, state->vmconfig_n);
         if(err) goto exit;
     }
@@ -1213,9 +1221,11 @@ int main(int argc, char *argv[]){
     int long_index = 0;
     static const char * LOGFILE = "/var/log/xfrd.log";
 
+#ifndef DEBUG
     freopen(LOGFILE, "w+", stdout);
     fclose(stderr);
     stderr = stdout;
+#endif
     dprintf(">\n");
     set_defaults(args);
     while(1){